package handlers

import (
	"car-trade-sys/model"
	"github.com/gin-gonic/gin"
	"net/http"
	"strconv"
)

func OrderAdd(c *gin.Context) {
	orderCode := c.PostForm("orderCode")
	orderGood := c.PostForm("orderGood")
	orderForm := c.PostForm("orderForm")
	orderTo := c.PostForm("orderTo")
	cid, _ := strconv.Atoi(c.PostForm("cid"))
	order := model.CarOrder{
		OrderCode: orderCode,
		OrderGood: orderGood,
		OrderForm: orderForm,
		OrderTo:   orderTo,
		Cid:       cid,
	}
	model.DB.Create(&order)
	c.JSON(http.StatusOK, gin.H{
		"code": 200,
		"msg":  "添加成功",
	})

}
